<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        <!-- <button v-on:click="num++">点击</button>-->
        <!-- <button v-on:click="add">点击</button><br> -->
        <button @click="add">点击1</button><br>
        <button @click="add()">点击2</button><br>
        <button @click="getVal">获取值</button><br>
        <button @click="getValParams(1,2,$event)">传递参数</button><br>
        <span>{{num}}</span>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                num: 10
            },
            methods: {
                add() {
                    this.num++;
                },
                getVal(e) {
                    console.log(e.target.innerHTML);
                },
                getValParams(a, b, e) {
                    this.num = a + b;
                    console.log(e.target.innerHTML);
                }
            }
        });
    </script>
</body>

</html>